home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Floppyshop 2
/
Floppyshop - 2.zip
/
Floppyshop - 2.iso
/
diskmags
/
5791-.end
/
dmg-6058
/
files
/
man4.txt
/
man4.txt
Wrap
Text File
|
1998-10-24
|
26KB
|
512 lines
Chapter Four:
About
Disks, Disk Drivers, TOS, Formatting,
File Storage, and Copying.
Regrettably, much of the information regarding disk formats in
previous versions of the manual was wrong. This was due to
misconceptions about format procedures. These misconceptions are
widespread; many of the formatting programs available are poorly
written: you risk loss of data by using them.
I thank Olafur Bragason of our UG for explaining much of the
following to me.
It is very difficult to talk "just about the format," as if we
could ignore TOS. TOS, ("The Operating System"), is called on
other machines the DOS, the Disk Operating System. You notice
this mostly as the File Selection Window. TOS keeps track of what
directories have been moving in and out of the drive. When you
read a new disk, by updating the directory window, TOS reads the
directory and the FAT into memory. That stays there until you
read a new disk. The old directory is erased from memory and a
new directory is read in.
TOS is therefore an interaction between the memory, the directory
window, the FAT, the drive, the drive head, the disk, the format
on the disk, and the directory on the disk. Complicated? You
bet. It is difficult to talk only about one of these. To start,
let's look at formats.
The disk stores data. That data must be placed on the disk in a
fashion so that the drive can put it there and quickly find it
again. The format is a structure which helps the drive head know
where the head is on the disk.
As a Macintosh text puts it, the disk is like a parking area:
white lines have to be drawn so that the cars can go into spaces.
By drawing the lines correctly, more can fit into that total
area.
How a disk is formatted (structured) is up to the person who
writes a formatting program, within the physical limits of the
drive mechanism.
ASSUMING THE STANDARD FORMAT: HOW YOUR DRIVE WORKS
Your disk is divided into concentric rings, called TRACKS. These
rings, or TRACKS, are divided into SECTORS.
Assuming the standard ST format, track #0 is on the outside.
Track #79 is near the centre. The first few tracks and sectors
are used for storing information about the disk and files. There
are eighty tracks (0,1,2,3...78,79 = 80). On each TRACK (or ring)
are 9 SECTORs. These are numbered 1,2,3,4,5,6,7,8, and 9. Every
sector can therefore be identified: for example, Track 54, sector
4.
On a single sided disk, the data is stored as following:
Track 0, Sector 1 = Boot Sector
Track 0, Sectors 1-6 = FAT 1
Track 0, Sector 7 to Track 1, Sector 2 = FAT 2
Track 1, Sector 3 to Track 1 Sector 9 = Directory
Track 2 to Track 79, Sector 9, = Files.
The File Allocation Table (FAT) keeps a list of where your file
gets scattered all over the disk. For safety, TOS keeps a backup
copy on disk; this is FAT 2.
If you want to fool around with the FAT, then here are the values
for FAT entries. The FAT has one entry for every data cluster on
the disk. If the entry for cluster n is m, then four things are
possible.
m = 0 (zero), then the cluster is not in use.
m = FF1-FF7 means that the cluster is damaged and should not
be used.
m = k where 0<k<FF1; this means that cluster n is part of a
file and that cluster k is the next cluster in the file.
m = FF8-FFF; this means that cluster n is the last cluster
in the file.
It is not necessary to know this information for using the ST.
The Directory is just that: the list of which files are active on
disk. When looking for your files, go to track 1, sector 3. The
directory keeps only the name of the file, the location of the
first cluster for that file, and the kilobyte size of the file.
On a double sided disk, the data is stored as follows:
Side A, Track 0, Sector 1 = Boot Sector
Side A, Track 0, Sector 2 to 6 = FAT 1
Side A, Track 0, Sectors 7,8,9,
plus Side B, Track 0, Sectors 1 and 2 = FAT 2
Side B, Track 0, Sectors 3 to 9 = Directory
Side A and B, Track 1 to 79 = Files.
We can immediately see problems. Most file recovery programs are
set to look automatically in a specific area for the directory
sectors. A recovery program made for single sided disks will look
in track 1, sectors 3 to 9. But if we are using a double sided
disk, then this recovery program, set to look for directory
sectors in track one, will find files. A double sided recovery
program will not be able to find the directory of a single sided
disk, because it is looking for side B, which doesn't exist.
Each sector holds a maximum of 512 bytes, or 0.5KB. This is
effective with large files, but small files, fx SPOOLER, which is
only 497 bytes, will be inefficiently stored. The smallest
storage unit is a CLUSTER which is two sectors. Thus your drive
will use a cluster, or 1024 bytes of space, to store 497 bytes.
The rest is ignored.
The sector is made of a header, the file data, and a closing
remark.
As the disk head goes flying along, it meets a new sector. First
it reads the information in the header. The first information
identifies the track number. Then follows the disk side
information, then sector number, size of sector, and then the
CRC, the Cyclic Redundancy Code (to check for possible errors).
Then the head reads the data in the sector. At the end is the CRC
again. This closes the sector. Now onto the next sector.
So the head reads sectors 1, 2, 3, 4, etc in a row in each track.
Now on to the next track. But to switch over from one track to
the next leaves very little time, so to make sure that it has
gotten into the correct track, it waits a whole new turn in order
to read sector 1.
Therefore much of the time, the head is being very careful about
where it is.
If the disk is new (blank), then the drive starts at the outside
and works its way inward, saving/reading data along the way. But
if the disk has been used very much (files deleted, saved,
redeleted, etc) then lots of spaces open up between active files.
The computer will then store data on those tracks and sectors,
scattering your data not in one long piece, but here and there,
anywhere it can find space. This is effective for using the disk
in the best way possible, although it will increase the time for
the process.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
It's a good trick (thanks, KHS,) every once in a while to copy
all of your files to a new, blank disk. Then the files will be
re-stored in the most efficient way, one after the other, sector
by sector, in one long line. This reduces access time terrifi-
cally. You can do this by transferring all your files into a
RAMdisk, deleting all the files from the disk (just throw them
from the disk into the wastebasket), and then saving again from
the RAMdisk to disk. This can save 30 to 40% time, especially on
a boot disk. This is especially effective on a Harddisk.
Place the large programs first onto the disk; those programs
which you read only and never change.
A "disk organizer" is very useful; it sorts out the files on a
disk and places them in the most consecutive way possible. This
is very useful on a harddisk.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Remember, the disk drive head works in the most careful way
possible: it floats over the first track and then moves inward.
It starts at the outside the first time.
This is not however efficient: the directory could be placed in
the centre of the tracks, for example, and the most distant file
would not be more than half a disk away.
TOS was written to be compatible with IBM PCs (you can find those
in museums). Many users have noticed that they can read IBM
formatted 3.5 inch disks. It seemed like a good idea. TOS, and
the ST, was developed in only six months.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A double sided drive works the same way. Both heads move over the
disk, but together, not separately. Hence a single sided drive
cannot read a double sided disk because a double sided disk has
track one on side A and track 2 on side B and track 3 on A side
and so on. It reduces access time, but makes it impossible for a
single sided drive to read, because all it finds on the top side
is track 1, 3, 5, etc.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A possible use of the option of giving the disk a name is
suggested by OB. He names the disk according to the formatting
program so that he knows how it was formatted.
It rather difficult, however, to change the disk name afterwards
without a new format. VOLUME.PRG can, in certain cases, change
the disk name, but only once. Again, this has to do with the
nature of TOS.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Finally, there are programs to check the disk drive speed
(SPEED.PRG). A correct value should be 300 to 305. If higher or
lower, it is possible that the drive is reading/writing data
incorrectly (the disk sectors will show up too soon/too late for
the disk head).
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
NON-STANDARD FORMATS
In the past half year, we have seen some very clever formats.
Some of these place sectors in better patterns. Others take
advantage of peculiar aspects of the disk head mechanism to
improve read/write speed.
Why would anyone not use the standard ST format? Non-standard
formats can do several things. You can format faster (often
just 18 seconds for a format). You can read/write much faster;
often more than 50% faster. You can also put much more on a disk
(up to 55KB more per single sided disk, or even 118KB more with a
hyperformat). If you have 40 disks, this can be about 2000 KB
more, just on single sided disks.
You must understand how a non-standard format functions.
Otherwise, it is pretty certain that you will lose data.
Back to the number of sectors/tracks, and their layout. There can
well be more or less than 9 sectors. Eleven sectors seems to be
the maximum limit. Amiga disks possibly have one sector per
track. There can be up to 86 tracks, for example, instead of 79
(the first track is number 0, so "79 sectors" is actually 80). It
is a mechanical limit that keeps most drives from making more
than 82 tracks: the better heads can go further towards the
centre of the disk.
A formatting program also creates a sector called a BOOT SECTOR.
This is used for making a boot disk. If you use another disk for
booting, then you can choose not to have a boot sector on a disk.
Thus you can store data on that sector. The standard ST format
always creates a boot sector; you can boot with any such disk.
Another trick is to make fewer directory sectors. The standard
format allows space for 112 entries; you can keep up to 112 files
on a single sided disk. This is somewhat generous; you could have
for example a maximum of 64 entries. Do this by specifying only 4
directory sectors, instead of 7. That gives you three more
sectors for data.
By these various methods, then, if you have a good disk drive,
and a good formatting program, you can place 11 sectors in 86
tracks, with no boot sector, short directory sectors, and you can
have up to 475 KB on a single sided disk.
A STANDARD FORMAT has 357KB per side.
An EXTENDED FORMAT has 390 KB per side.
A FAT DISK or FAT FORMAT has 412 KB per side.
A HYPERFORMAT has up 475 KB or more per side.
The sectors can also be laid nonsequentially on a track. Instead
of putting 1-2-3-4-5-6-7-8-9-10-11, the sectors can be 1-7-2-8-3-
9-4-10-5-11-6- and on to 1 again; this cleverly gives the head a
space between each sector. As it reads sector two, it finishes
and is ready for sector 3. But on a standard format, 3 comes
right after 2. That is too fast, and hence it must wait another
turn of the disk. A nonsequential format gives the head a space
between sectors to get ready for the new sector: it reads sector
2, skips sector 8, and then reads sector 3.
(There is some discussion here about why some programs can read
faster than others. TEMPUS can read a file much much faster than
1st Word. Tempus possibly creates a buffer into which the file is
first placed, and then organized for the program's use. 1st Word
will read the sector first, and then spend time organizing it and
placing it in word processing format. Then it reads the next
sector. But by this time, the head has already gone too far; 1st
Word must wait for the disk to turn once again in order to read
the second sector. The many "Fast Read" programs thus deal with
this aspect of 1st Word, which is why they don't help with other
programs.)
The first sector on the track can also be "sacrificed;" made
useless, so that no data is stored there. An error is written
onto that sector. This has the advantage of letting the head
swing immediately over to the next track, reading the first
sector, checking that it is on the correct track, and then going
onto the second sector, where it can begin to read at once,
instead of waiting for a new turn.
It is in exploiting characteristics of the Atari disk drive that
"FAST FORMATS" are made. Since they give the head more time to
read, by either skipping sectors or with blank final sectors, the
head reads the data correctly. These "fast" formats are safe.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The directory window, the TOS, the disk drive mechanism, and a
misunderstanding of the disk identification procedure all comes
together to produce the next problem. This was widespread most of
last year, causing many people the dreaded "directory crashes."
The ST drive has a way of speeding things up. If you open a
folder and look inside and then close again, the ST immediately
gives you the previous window again, with all of the contents,
without re-reading the disk. The ST saves some of the information
of the directory reading (the contents of the window) to memory.
It assumes that you did not change disks; it just reads the
previous directory from memory.
What happens when the computer reads a new disk? The ST uses an
80 byte space in the memory to hold information about the disk.
First the directory sectors are read (file names, file informa-
tion (date, size, folders, etc.). Then the FAT (File Allocation
Table, where the file is spread over the individual sectors) is
read into memory. The file names and folder names are sent to the
file selector window. When you enter a folder, the ST goes "down"
into a second level; it keeps the first level in memory and reads
the information for the second level. When you go into a further
folder within a folder, then it is "down" three levels. As you
move back up from the third level, it reads the second level from
memory, not the disk. To go from the second level to the first,
top level, it again reads from memory. At any point, whatever
level you are in, you click on a file, the ST looks at the FAT in
memory and knows where to start looking for the file on the disk.
The entire time, the ST must be certain that you did not change
disks: if you change disks, then the FAT information and the
stored directories are worthless.
To prove this, take out the disk in the machine and put in
another disk (which is not write protected ("write protect" is
the little tab in the back corner of the disk) and was formatted
by the ST format menu). The drive noticed that you took out a
disk (An infrared light shines through the write protect hole.
The infrared light which detects write protection was blocked for
a moment as the disk went by, and then for a moment was
unblocked, and then blocked again). Click on OPEN FILE. The
drive will start up and read the directory. Click CANCEL. Open
the directory again. This time, the drive doesn't run. The
directory was read from memory. Click on the grey bar at the top
of the file select window. The window refreshes, but the drive
doesn't run. TOS knows that you haven't changed disks: the
infrared light wasn't blocked as if a disk had gone in and out.
Hence it just uses the information from memory.
On every screen redraw, which happens about 70 times per second,
TOS takes a look at the drive and checks whether the infrared
light is blocked.
Now put a write protected disk into the drive (push the tab so
that the hole is open). Open file select. The drive runs, because
it knew a disk was removed. Click Cancel. Open again. Drive runs
again. The light is shining through the write tab; for all it
knows, a disk has been moved. So it checks again. Click on the
grey bar. The drive runs again. In the test above, the
directories were read from memory. Now, TOS reads them every time
from disk.
Since TOS, on each screen redraw, sees the light shining, it can
only assume that the disk has been removed.
TOS is checking serial numbers. When you format a disk, the disk
gets a random number as its identification: the disk serial
number. TOS checks these numbers to know whether it should make a
new directory reading or whether it can just use the previous
directory in memory.
This is where a great deal of problems come from. Most formatting
programs don't change the serial number. Apparently, most persons
who wrote formatting programs didn't know about this. Some of the
standard documentation (the books for programmers) contain this
error. They don't explain that the serial number on the page is
an example. So the number is either set to zero or perhaps the
same for all formats. You end up with a box of disks which are,
for TOS, identical. When you start switching disks, TOS is going
to start adding each new directory to memory, thinking that it is
all the same disk: the serial number is identical. Imagine the
problems if all women looked alike. This "false" serial numbering
is the reason for most of the directory crashes, directory window
problems, opening a folder but nothing happening, and "wrong"
directories which most users have seen if they have used
formatting programs (especially FAT formats). One frequent error
occurs in 1stWord / Wordplus: you open a directory, open a
folder, and then switch disks and update the directory. TOS
thinks that the same disk in in the drive (serial numbers are
identical) and therefore will try to go "up the directory tree",
that is, just return to the level above. But there it will find
entirely different information. If you try to save your document
at this point, say goodbye. TOS will get disk information from
the first disk (where the blank sectors are, etc). You now have
the second disk with an identical serial number: TOS will save
your document onto the second disk as if it were the first disk.
Your data goes on top of other data. The ST uses the FAT from the
first disk to save information on the second disk.
Remember that the directory sector holds files. It also holds
folder names; but only the names, not the contents. The directory
contents of the folders is not kept in the directory sectors:
that is kept in the data sectors. (Hence, a disk can hold a
maximum of only 112 files. But if you place files in a folder,
then you can have unlimited number of files.)
Make a "wrong" format disk (two with identical serial numbers).
Place a number of files and folders and folders in folders on
each. Enter the first disk, go down a few levels. Change disks.
Ask for a directory re-read to read the new directory. The ST
uses the FAT of the first disk to find the contents of the
folder. All it is going to find in the second disk's file sectors
is stored data from that disk, not the file names which should be
there. Hence you are going to see recognizable bits and pieces of
perhaps a text file in your file selector box. At this point, the
experiment is over: the FAT is destroyed and all of the files on
the disk is lost.
It is therefore essential that you use formats which correctly
give a random serial number to a disk. If you are having problems
with the directory windows, now you know why. Use either
the standard ST menu format, FCOPY_2.PRG or ALPHAFORMAT.PRG.
The write-protected directory re-read, which checks serial
numbers, is used by some commercial programs as a copy
protection. The program is making sure that you have the original
disk somewhere on your desk.
You can recognize this problem if you have a non-standard format
made with a poor formatter. You click on a folder to open it, and
the drive runs and the screen blinks, but nothing happens. The ST
has tried to check the serial number, finds that it is the same,
and simply reads the directory again. You get a new directory,
which is simply the one you had before.
This is why the directory window, which otherwise works so well,
can get so confused if you pop non-unique serial numbered disks
in and out, reading new directories each time, opening and
closing folders. If the disks have been formatted without a
unique serial number, then the directory window thinks that you
have not changed disks: the serial numbers are identical
(usually all are zero). But since it is in fact a different disk,
the identification of the sectors/tracks will be wrong. So when
the ST tries to read the sector, it opens the folder, but
doesn't find the correct data. You get a totally blank directory
window.
Don't panic. Your computer can smell panic.
Simply give the ST a disk which has been correctly formatted
(that is: it has a unique serial number). The ST becomes happy
because now it KNOWS that the disk is different: it performs a
new directory reading and everything is okay again.
The serial number is exploited as a form of copy protection.
When the original is made, the program makes a note of the serial
number. When you make your backup copy, your correct formatting
program will give the disk a new serial number, as it should. But
the program will see that the number has been changed, and
therefore reject the copy. Ironically, a "bad" formatting program
(which does not set new serial numbers correctly) is good for
making backup copies of programs which are protected in this way.
Some copy protected programs will, at random, cause TOS to check
the disk for the correct serial number. You will notice that the
drive runs every once in a while. TOS is checking the serial
numbers. The program will then compare that number with the
number that the disk was given when it was formatted at the
factory.
I wrote above that an exotic format may cause loss of data. There
are several ways. If the serial numbers are incorrect, then TOS
will know from the first disk where the blank sectors are. When
you insert the second disk with the same serial number, then TOS
will write data onto sectors which it thinks are blank. If you
have extra sectors/tracks, and use a sector copy program which
does not know how to find those sectors/tracks, then the extra
data will be lost.
Normally, the information about the format of the disk is at the
beginning of the disk. That is usually automatically read by a
copy program when the disk drive starts up; but if the copy
program is stupid (doesn't check for strange/different format
structures), then it will apparently copy the entire disk, and,
when you check it, everything seems to be there. But since the
special format stores things in "illegal" places, the copy
program will not find that illegal data, even with a format
monitor and verification ON (telling the copy PRG to verify the
copy). Most copy PRGs don't look for those extra tracks. Parts of
your files will be missing. Asking the SHOW INFO doesn't help; it
correctly keeps the information in the directory sector that your
file is 243,678 bytes long, but that information is stored in the
directory sector anyway; whether the actual clusters exist is
another matter. The only certain way to make a backup of an
extended format / fatdisk / hyperdisk is with a RAM disk or an
intelligent formatting program.
Again, if you're going to make a disk which will be copied
repeatedly by different people (a PD disk, for example), then use
the standard 356KB format.
The point is: use radical formats only if you:
Know what you are doing.
Are using a good formatting program.
Have a backup.